<template>
	<view class="purchaseAppoint">
		<uni-nav-bar
			color="#ffffff"
			background-color="#00aded"
			:statusBar="true"
			title="运行监控"
			fixed="true"
			left-icon="arrowleft"
			left-text="返回"
			@clickLeft="back"
		></uni-nav-bar>
		<view class="purchaseAppoint_top">
			<!-- 搜索 -->
			<!-- 搜索 -->
			<dil-search :columnData="options.columnDataList" @onSearch="onSearch" v-if="options.columnDataList.length > 0"></dil-search>
		</view>
		<view class="purchaseAppoint_main">
			<dil-card class="dilCard" @emitEvent="emitEvent" v-bind.sync="options"></dil-card>
		</view>
		<view class="purchaseAppoint_floot"></view>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
export default {
	data() {
		return {
			options: {
				requestUrl: '/api/v1/ams/getPurchaseRequirementList?apiId=572',
				requestQuery: {},
				cardSlotList: [],
				columnDataList: [],
				totalNum: 0
			}
		};
	},
	onShow() {
		uni.$emit('onShow', 1);
	},
	mounted() {},
	methods: {
		back() {
			uni.switchTab({
				url: '/pages/index/index'
			});
		},
		onSearch(item) {
			this.options.requestQuery = JSON.parse(JSON.stringify(item));
		},

		emitEvent(eventName, cardItem) {
			this[eventName](cardItem);
		},
		detailBrowse(item) {
			console.log(item);
			console.log('详情');
		},
		transOrderBrowse(item) {
			console.log(item);
			console.log('运输订单详情');
		},
		purchasePlanAdd(cardItem) {
			this.updatePurchaseAppointItem(cardItem);
			uni.navigateTo({
				url: '/pages/transPlan/purchasePlanAdd'
			});
		},
		//vuex
		...mapMutations('purchase', ['updatePurchaseAppointItem'])
	}
};
</script>

<style lang="scss" scoped>
.purchaseAppoint {
	width: 100vw;
	height: 100%;
	background-color: #f5f5f5;
	&_top {
		background-color: #fff;
	}
	&_main {
	}
	&_floot {
		background-color: #fff;
	}
}
</style>
